<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    //判断是否为奇数
    function isPrime(num) {
        let flag = true;
        for (let i = 2; i < parseInt(num / 2); i++) {
            if (num % i == 0) {
                flag = false;
            }
        }
        return flag;
    }
    //判断是否满足哥德巴赫猜想
    function OddPrimeNumber(n) {
        let x, y;
        let flag = false;
        for (let i = 2; i < n; i++) {
            //判断n是否是两个素数的和
            if (isPrime(i) && isPrime(n - i)) {
                flag = true;
                x = i;
                y = n - i;
            } else {
                continue;
            }
        }
        if (flag) {
            alert(n + '=' + x + '+' + y)
        } else {
            alert('不满足哥德巴赫猜想！')
        }
    }
    let num;
    do {
        num = parseInt(prompt('请输入一个数：'));
        OddPrimeNumber(num);
    } while (num != 0)
</script>

</html>